CC       = gcc
CFLAGS   = -Wall -O -g
CXXFLAGS =
INCLUDE  = -I $(shell pwd)/dynamiclib/inc
TARGET   = dynamiclibapp
LIBVAR   = -lmytest
LIBPATH  = -L$(shell pwd)/dynamiclib/libs
ROOT 	 = $(shell pwd)/dynamiclib/libs
RPATH 	 := -Wl,-rpath,$(ROOT)
OBJS     = dynamiclibapp.o

all: $(OBJS)
	cd ./dynamiclib && make all
	$(CC) $(CFLAGS) $(INCLUDE) $(OBJS) $(LIBPATH) $(LIBVAR) $(RPATH) -o $(TARGET)
	
dynamiclibapp.o: dynamiclibapp.c
	$(CC) $(CFLAGS) $(INCLUDE) -c $^



clean:
	rm -f *.o
	rm -f comm/inc/*.gch
	rm -f $(TARGET)
	cd ./dynamiclib && make clean